package com.opgea.crm.web.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.opgea.crm.domain.entities.Company;
import com.opgea.crm.services.CompanyService;
import com.opgea.crm.services.SetupService;


@Controller
@RequestMapping("/index")
public class CompanyController {
	Logger logger=Logger.getLogger(CompanyController.class);
	@Autowired
	CompanyService companyService;
	@Autowired
	SetupService setupService;

    
	@RequestMapping(method=RequestMethod.GET)
	public String createCompany() {

		logger.debug("I am in Controller createCompany...");
		Company company=new Company();
		company.setIndustryType(setupService.findById(1));
		company.setName("SourcePundit");
		company.setWebsite("www.st.com");
		companyService.createCompany(company);
		
		return "home";
	}

	
}
